import request from "./request";

function getSubjectData(data) {
  // 取本地的json数据
  return request({
    url: "/json/subjectData.json",
    method: "get",
    // data,
  });
}

function getIndexData(data) {
  // 取本地的json数据
  return request({
    url: "/json/index.json",
    method: "get",
    // data,
  });
}

function getDetails(data) {
  return request({
    url: "/json/details.json",
    method: "get",
    // data,
  }).then((res) => {
    const jsonData = res.find((post) => post.id === data.id) || null;
    return jsonData;
  });
}

function getFilesList(data) {
  return request({
    url: "/json/files.json",
    method: "get",
    // data,
  }).then((res) => {
    const jsonData = res.find((post) => post.id === data.id) || null;
    return jsonData;
  });
}
export { getSubjectData, getIndexData, getDetails, getFilesList };
